﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BT211.Models
{
    public class Battle
    {
        public string Name { get; set; }
        public Map Map { get; private set; }
        public List<BattleState> History { get; private set; }

        public BattleState CurrentState
        {
            get
            {
                BattleState returnState;
                if (History.Count > 0)
                    returnState = History[History.Count - 1];
                else
                {
                    returnState = new BattleState();
                    History.Add(returnState);
                }
                return returnState;
            }
        }


		public void Tick()
		{
			// Deep-copy from the previous state in the history to the current state.


			// Run the behavioural adjustments on agents.
			foreach (Agent agent in CurrentState.Agents)
			{
			}

			// Then, nudge all of the field objects.
			foreach (FieldObject obj in CurrentState.FieldObjects)
				obj.Position += obj.Velocity;
			
			// Run collision detection.

			// Evaluate terminal conditions.
		}
    }
}
